﻿Imports DTO
Imports System.Data.SqlClient

Public Class LinhVucDAO

    Shared Function layDsLinhVuc() As List(Of LinhVucDTO)
        Dim dsLV As New List(Of LinhVucDTO)
        Dim cn As SqlConnection = CKetNoi.Connect
        Dim cmd As New SqlCommand
        cmd.CommandText = "usp_layDSLinhVuc"
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Connection = cn
        cn.Open()
        Dim reader As SqlDataReader = cmd.ExecuteReader
        While reader.Read
            Dim lv As New LinhVucDTO
            lv.Ma = reader("Ma")
            lv.MaLinhVuc = reader("MaLinhVuc").ToString.Replace(" ","")
            lv.TenLinhVuc = reader("TenLinhVuc")
            dsLV.Add(lv)
        End While
        cn.Close()
        Return dsLV
    End Function

End Class
